﻿@model List<thailandProject.Models.RESERVATION>

@{

   ViewBag.Title = "View Apartment Reservations";

}

<div id="Wrapper2">

   <div id="content_header">

       <div id="headerimage">

       </div>

       <div id="theheader">@ViewBag.Header</div>

   </div>

   <!-- Left Column begins here -->

   <aside id="sidebar-wrapper">

       <nav class="sidebar">

           <!-- CONTENT GOES HERE -->

               

           @if (Model != null && Model.Count > 0)

           {
               int counter = 0;
               <table>

                      <tr>

                          <th>Property Name</th>

                          <th>First Name</th>

                          <th>Last Name</th>

                          <th>Start Date</th>

                          <th>End Date</th>

                      </tr>

               @foreach (var r in Model)

               {    
                   
                   <tr>

                       <td>@Html.DisplayFor(modelItem => r.PROPERTY.propName)</td>  

                       <td>@Html.DisplayFor(modelItem => r.CLIENT.clientFirstName)</td>

                       <td>@Html.DisplayFor(modelItem => r.CLIENT.clientLastName)</td>

                       <td>@r.resStartDate.ToString("MMM dd, yyyy")</td>

                       <td>@r.resEndDate.ToString("MMM dd, yyyy")</td>

                   </tr>
                   counter++;

                   if (counter % 2 == 0)
                   {
                       <tr>
                           <td colspan="5">&nbsp;</td>
                       </tr>
                   }
               }

               </table>
           }

           else
           {

               <p>No double books detected.</p>
           }

            @Html.ActionLink("Back to Reporting Index", "Index")

       </nav>

       <!-- Left column ends here -->

   </aside>

   <!-- Right column begins here -->

   <article id="contents">

       

   </article>

   <!-- Right column ends here -->

</div>

<!-- Div wrapper2 ends here -->

<script>
    $(document).ready(function () {
        if ($("#showAll").next().attr('value') == 'false' || $("#showAll").next().attr('value') == 'False' || $("#showAll").next().attr('value') == '') {
            $("#showAll").attr('src', '../../images/unchecked.png');
        }
        else {
            $("#showAll").attr('src', '../../images/checked.png');
        }

        $("#showAll").click(function () {
            if ($(this).next().attr('value') == 'false')
            {

                $(this).attr('src', '../../images/checked.png');
                $(this).next().attr('value', 'true');
            }
            else
            {
                $(this).attr('src', '../../images/unchecked.png');
                $(this).next().attr('value', 'false');
            }
        });
    });
</script>